<%--
  Created by IntelliJ IDEA.
  User: LLg
  Date: 2022/11/22
  Time: 10:04
  To change this template use File | Settings | File Templates.
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<html>
<head>
    <title>Title</title>
    <base href="${pageContext.request.contextPath}/">
    <link rel="stylesheet" href="statics/layui/css/layui.css">
    <script src="statics/layui/layui.js"></script>
</head>
<body>
<div style="color: red">${errorMsg}</div>
<form class="layui-form" action="" lay-filter="formUpdate" onsubmit="return false">
    <div class="layui-form-item">
        <label class="layui-form-label">登录名称</label>
        <div class="layui-input-inline">
            <input type="text" name="login_name" required lay-verify="required" autocomplete="off" class="layui-input"
                   value="${sysUser.login_name}">
        </div>
    </div>
    <div class="layui-form-item">
        <label class="layui-form-label">用户名称</label>
        <div class="layui-input-inline">
            <input type="text" name="user_name" required lay-verify="required" autocomplete="off" class="layui-input"
                   value="${sysUser.user_name}">
        </div>
    </div>
    <div class="layui-form-item">
        <label class="layui-form-label">部门</label>
        <div class="layui-input-inline">
            <input type="text" name="user_type" required lay-verify="required" autocomplete="off" class="layui-input"
                   value="${sysUser.user_type}">
        </div>
    </div>
    <div class="layui-form-item">
        <label class="layui-form-label">用户状态</label>
        <div class="layui-input-inline">
            <input type="checkbox" name="status" value="0"${sysUser.status=="0"?"checked":""} lay-skin="switch"
                   lay-vayify="" lay-text="启用|禁用">
        </div>
    </div>
    <div class="layui-form-item">
        <label class="layui-form-label">手机</label>
        <div class="layui-input-inline">
            <input type="text" name="phonenumber" required lay-verify="required" autocomplete="off" class="layui-input"
                   value="${sysUser.phonenumber}">
        </div>
    </div>
    <div class="layui-form-item">
        <label class="layui-form-label">创建时间</label>
        <div class="layui-input-inline">
            <input type="text" name="create_time" required lay-verify="required" autocomplete="off" class="layui-input"
                   value="${sysUser.create_time}">
        </div>
    </div>
    <div class="layui-form-item">
        <div class="layui-input-block">
            <button class="layui-btn" lay-submit lay-filter="formDemo">立即提交</button>
            <button type="reset" class="layui-btn layui-btn-primary">重置</button>
        </div>
    </div>
</form>
<script>
    layui.use(['form', 'jquery'], function () {
        var $ = layui.jquery;
        var form = layui.form;
        form.on('submit(formDemo)', function (data) {

            var formUpdate = form.val("formUpdate");
            $.post("${pageContext.request.contextPath}/sysUser/update", formUpdate, function (result) {
                if (result) {
                    layer.msg("修改成功", function () {
                        var index = parent.layer.getFrameIndex(window.name)
                        parent.layer.close(index)
                        window.parent.location.reload()
                    })
                } else {
                    layer.msg("修改失败")
                }
            })
            return false;
        });
    });
</script>
</body>
</html>
